package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Records;
import com.woniuxy.mapper.RecordsMapper;
import com.woniuxy.service.RecordsService;
import com.woniuxy.util.PageData;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class RecordsServiceImpl implements RecordsService {
    private RecordsMapper recordsMapper;

    @Override
    public PageInfo<Records> queryRecords(PageData<Records> pageData) {
        PageHelper.startPage(pageData.getPageNum(),pageData.getPageSize());
        List<Records> records = recordsMapper.queryRecords(pageData.getParam());
        PageInfo pageInfo = new PageInfo(records);
        return pageInfo;
    }

    @Override
    public void payRecord(Integer id) {
        recordsMapper.payRecord(id);
    }
}
